package dao;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import pojo.Photo;

@Repository
public class ImageDAO {

  @Autowired
  private SqlSessionTemplate template;
  
  private static final String PHOTO_CLASS = Photo.class.getName();
  
  public void addImage(Photo photo){
    this.template.insert(PHOTO_CLASS+".add", photo);
  }
  
  public List<Photo> selectByUserID(Integer userID){
    return this.template.selectList(PHOTO_CLASS+".selectByUserID", userID);
  }
  public void delete(Integer ID){
    this.template.delete(PHOTO_CLASS+".deleteByImageID", ID);
  }
}
